//
//  AddressBackView.m
//  Experss
//
//  Created by 嗯，大葱 on 17/8/16.
//  Copyright © 2017年 嗯，大葱. All rights reserved.
//

#import "AddressBackView.h"

@implementation AddressBackView

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        self.backgroundColor = [[UIColor blackColor] colorWithAlphaComponent:0.5f];

        [self configureV];
    }
    return self;
}

- (void)configureV {
    
    UIView *bgV = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreen_Width - 100, 150)];
    bgV.backgroundColor = [UIColor whiteColor];
    bgV.layer.masksToBounds = YES;
    bgV.center = self.center;
    bgV.layer.cornerRadius = 5;
    [self addSubview:bgV];
    
    
    _backBtn= [UIButton  buttonWithType:(UIButtonTypeCustom)];
    _backBtn.frame = CGRectMake(0, CGRectGetHeight(bgV.frame)-45, CGRectGetWidth(bgV.frame)-0, 45);
    [_backBtn setBackgroundImage:[UIImage imageNamed:@"bg1"] forState:(UIControlStateNormal)];
    [_backBtn setTitle:@"确定" forState:(UIControlStateNormal)];
    _backBtn.layer.masksToBounds = YES;
    _backBtn.layer.cornerRadius = 5;
    [bgV addSubview:_backBtn];
      [_backBtn addTarget:self action:@selector(buttonAction:) forControlEvents:UIControlEventTouchUpInside];
    
    
    _titleLB = [[UILabel alloc] initWithFrame:CGRectMake(0, 10, CGRectGetWidth(bgV.frame), 30)];
    _titleLB.textColor = [UIColor blackColor];
    _titleLB.textAlignment = NSTextAlignmentCenter;
    [bgV addSubview:_titleLB]
    ;
    
    
    _conLB = [[UILabel alloc] initWithFrame:CGRectMake(0, CGRectGetMaxY(_titleLB.frame)+10, CGRectGetWidth(bgV.frame), 30)];
    _conLB.textAlignment = NSTextAlignmentCenter;
    _conLB.font = kFont15;
    _conLB.textColor = [UIColor blackColor];
    //_conLB.center = bgV.center;
    [bgV addSubview:_conLB];
}



-  (void)buttonAction:(UIButton *)button
{
    if (self.buttonAction) {
        // 调用block传入参数
        self.buttonAction(button);
    }
}
@end
